import { useState } from 'react';
import styles from './Login.module.less';
import loginBanner from "@/assets/image/login-banner.png";
import UserLogin from './components/UserLogin';
import QRCodeLogin from './components/QRcodeLogin';

const Login = () => {
  const [loginType, setLoginType] = useState(1);

  const changeLoginType = () => {
    if (loginType === 1) {
      //切换为扫码
      setLoginType(2);
      // this.getQrcode();
    } else {
      setLoginType(1);
      //切换为账号登录
      // this.codeTimer && clearInterval(this.codeTimer);
      // this.outTimer && clearTimeout(this.outTimer);
      // this.setState({
      //   loginType: 1,
      //   refreshLoading: true,
      //   isOuter: false,
      //   qrUrl: "",
      // });
    }
  };

  return (
    <div className={styles.login}>
      <div className={styles.login_banner_wrap}>
        <img src={loginBanner} className={styles.login_banner} />
      </div>
      { loginType === 1 ? <UserLogin onTypeChange={changeLoginType} /> : <QRCodeLogin />}
      {/* {ipcRender.isElectron ? <Title /> : null} */}
    </div>
  )
}

export default Login;